import java.util.HashMap;

public class Test {
    public static void countWord(String[] str){
        HashMap<String,Integer> map = new HashMap<>();

        for (String e: str) {
            if(!map.containsKey(e)){
                map.put(e,1);
            }else {
                int count = map.get(e);
                count++;
                map.put(e,count);
            }
        }
        System.out.println(map);
    }
    public static void main(String[] args) {
        String[] str = {"A","new","hello","I","am","A","is","a","am","am","is"};
        countWord(str);
    }
}
